package oop.core.skill;

import java.util.HashMap;
import java.util.Map;

public class SkillLibrary {
	private static Map<String, Skill> library = new HashMap<String, Skill>();
	private static int numItems = 0;
	
	public void init(){
		SkillLibraryLoader.init();
	}
	
	public static int getNumItems(){
		return numItems;
	}
	
	public static void addToLibrary(Skill elem)
	{
		String name = elem.getName();
		if(!library.containsKey(name))
		{
			library.put(name, elem);
			numItems++;
		}
	}
	
	/**
	 * This method assumes you filter your removals prior to calling this method. 
	 */
	public static Skill removeItemFromLibrary(String name)
	{
		Skill elem = library.remove(name);
		numItems--;
		return elem;
	}
	
	public static Skill getFromLibrary(String name)
	{
		return library.get(name);
	}
}
